package com.excilys.capicsoubank.selenium.pages;

import static org.fest.assertions.Assertions.assertThat;

public class TransferFormPage extends AbstractPage {
	@Override
	public String getUrl() {
		return BASE_URL + "/transfer";
	}

	/**
	 * Vérifie si on est bien sur la bonne page.
	 */
	@Override
	public void isAt() {
		assertThat(find(".navbar").find(".active")).hasSize(1);
		assertThat(find(".navbar").find(".active").find("a").first().getText())
				.isEqualTo("Transfers");
		assertThat(find("#amount")).hasSize(1);
	}

	/**
	 * Remplie le formulaire de virement et l'envoi.
	 * 
	 * 
	 */
	public void fillAndSubmitForm(String amount, int accountSource,
			int accountDestination) {
		fill("#amount").with(amount);
		click("#accountSource" + accountSource);
		click("#accountDestination" + accountDestination);
		click(".btn");
	}
}
